import java.awt.*;
import java.applet.Applet; // 引入Applet类

public class HelloApplet extends Applet {
    public void paint(Graphics g) {//完成图形绘制和文本输出
        //绘制坐标轴
        g.drawLine(20, 200, 300, 200); //横轴
        g.drawLine(20, 20, 20, 200); //纵轴
        g.drawLine(20, 170, 15, 170);
        g.drawLine(20, 140, 15, 140);
        g.drawLine(20, 110, 15, 110);
        g.drawLine(20, 80, 15, 80);
        g.drawLine(20, 50, 15, 50);
        //绘制柱形图标题
        g.setFont(new Font("隶书", Font.BOLD, 28)); //标题字体
        g.drawString("成绩分析表",70,40); //标题内容
        g.setColor(Color.black); //标题颜色
        //绘制横坐标
        g.setFont(new Font("Arial", Font.BOLD, 12)); //横坐标字体
        g.drawString("50-60", 27, 213);
        g.drawString("60-70", 77, 213);
        g.drawString("70-80", 127, 213);
        g.drawString("80-90", 177, 213);
        g.drawString("  >90", 227, 213);
        Color c = new Color(74, 144, 226); //横坐标颜色
        g.setColor(c);
        //绘制柱形
        g.fillRect(25, 180, 35, 20);
        g.fillRect(75, 170, 35, 30);
        g.fillRect(125, 140, 35, 60);
        g.fillRect(175, 120, 35, 80);
        g.fillRect(225, 170, 35, 30);
    }
}

